<?php
namespace Admin\Controller;
use Think\Controller;
class IsloginController extends Controller{
    function _initialize(){
        if(!isset($_SESSION["id"])){
            $this->error("请登录",U("Login/index"));
            exit();
        }
    }
    function layout(){
        if(isset($_SESSION['username'])){
            // session_unset();//free all session variable
            session_destroy();//销毁一个会话中的全部数据
            echo "<script>alert('退出成功');parent.location.href='index';</script>";
        }else{
            echo "<script>alert('退出失败');parent.location.href='index';</script>";
        }
    }

}